package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Menu;
import com.itheima.service.LkMenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author likun
 * @version V1.0
 * @date 2020/3/10 16:32
 */
@RestController
@RequestMapping("/menu")
public class LkMenuController {
    @Reference
    private LkMenuService menuService;
    @RequestMapping("/findAllMenu")
    public Result findAllMenu(){
        try {
            List<Menu> allMenu = menuService.findAllMenu();
            return new Result(true, MessageConstant.QUERY_MENU_LIST_SUCCESS,allMenu);
        } catch (Exception e){
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_MENU_LIST_FAIL);
        }
    }
}
